package cn.caplike.demo.repository.fastjson;

import com.alibaba.fastjson.JSON;

/**
 * Description:
 *
 * @author LiKe
 * @version 1.0.0
 * @date 2022-05-30 13:40
 */
public class FastjsonTest {

    public static void main(String[] args) {
        final AuthenticatedPrincipalToken principalToken = new AuthenticatedPrincipalToken();
        principalToken.setAuthSchema(AuthSchema.IMS_APP);

        final String jsonString = JSON.toJSONString(principalToken);
        System.out.println(jsonString);

        final AuthenticatedPrincipalToken deserialized = JSON.parseObject("{\"authSchema\":\"ims_app\",\"status\":0}", AuthenticatedPrincipalToken.class);
        System.out.println(AuthSchema.IMS_APP.equals(deserialized.getAuthSchema()));
    }

}
